@extends('layouts.mobile_main')

@section('title', '翻倍日历')

@section('resources')
    @parent
    <link rel="stylesheet" href="{{env('CSS_DOMAIN')}}/css/calendar.css?v={{env('CSS_VERSION')}}">
    <link rel="stylesheet" href="{{env('CSS_DOMAIN')}}/css/public.css?v={{env('CSS_VERSION')}}">
    <script src="{{ env('JS_DOMAIN') }}/js/adaptation.js?v={{env('JS_VERSION')}}"></script>
    <style>
        .kalendae{margin-top: 1rem;}
        .details_header{z-index: 101;}
        .details_header p{width: 8.5rem;}
    </style>
@endsection

@section('content')
<header class="details_header">
    <a class="fl" href="javascript:history.go(-1);">
        <img class="fl shop_back" src="{{env('IMAGE_DOMAIN')}}images/shop_back.png?v={{env('IMAGE_VERSION')}}" alt="">
    </a>
    <p class="fl tc co_violet fz_50">翻倍日历</p>
</header>
<p id="marxtimer" style="position:fixed;top: 0;left: 0;width: 100%;z-index: 100;"></p>
@endsection

@section("scriptResources")
    @parent
    <script src="{{env('JS_DOMAIN')}}/js/calendar.js?v={{env('JS_VERSION')}}" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
        window.onresize=function(){
            pagesp();
        }
        $("#marxtimer").css("height",$(document).height())
        new Kalendae({
            attachTo:document.body,
            months:2,
            mode:'multiple',
            selected:[Kalendae.moment().subtract({M:0}), Kalendae.moment().add({M:1})]
        });
        var datew=new Date();
        var monthto;
        if(datew.getMonth()<9){
            monthto="0"+(datew.getMonth()+1);
        }else{
            monthto=datew.getMonth()+1;
        }
        var datetoday=datew.getFullYear()+'-'+monthto+'-'+datew.getDate();
        var date="2016-09-18";
        var inmou=document.getElementsByClassName('k-in-month');
        for (var i = 0; i < inmou.length; i++) {
            if(inmou[i].getAttribute("data-date")==datetoday){
                inmou[i].innerHTML="今日";
            }
            if(inmou[i].getAttribute("data-date")=="2016-09-10"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>教师节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2016-09-15"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>中秋节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2016-10-01"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>国庆节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2016-10-09"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>重阳节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2016-12-25"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>圣诞节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2017-01-01"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>元旦节</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2017-01-27"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>除夕</label>"
                inmou[i].style.color="red";
            }else if(inmou[i].getAttribute("data-date")=="2017-02-11"){
                var x=inmou[i].innerHTML;
                inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: red;position:relative;top: -0.6rem;'>元宵节</label>"
                inmou[i].style.color="red";
            }
        };

        // var arrdate=["2016-11-08","2016-11-13","2016-11-24","2016-11-30","2016-12-06","2016-12-12","2016-12-19","2016-12-26"]
        var arrdate = "{{$lists}}";
        arrdate = arrdate.replace(/&quot;/gm,'"');
        arrdate = eval("("+arrdate+")")
        // console.log(arrdate)
        // alert(typeof(arrdate))
        for (var i = 0; i < inmou.length; i++) {
            for (var j = 0; j < arrdate.length; j++) {
                if(inmou[i].getAttribute("data-date")==arrdate[j]){
                    var x=inmou[i].innerHTML;
                    inmou[i].innerHTML=x+"<br><label style='font-size: 0.3rem;color: #fff;position:relative;top: -0.6rem;'>翻倍日</label>"
                    inmou[i].style.color="#fff";
                    inmou[i].style.backgroundColor="#9955c6";
                    console.log(inmou[i].innerHTML);

                }
            };
        }
    </script>
@endsection